package com.gtw.modules.api.controller;

import com.gtw.common.annotation.LoginUserApi;
import com.gtw.common.utils.R;
import com.gtw.modules.entity.TbProxyuserPay;
import com.gtw.modules.entity.TbUser;
import com.gtw.modules.sys.service.TbProxyuserPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/** 代理用户提交打款凭证
 * Created by wuye on 2018/3/20.
 */
@RestController
@RequestMapping("/api/proxyuserpay")
public class TbProxyuserPayController {

    @Autowired
    private TbProxyuserPayService tbProxyuserPayService;

    /**
     * 提交打款凭证
     * @return
     */
    @PostMapping("/submitProof")
    public R submitProof(@RequestBody TbProxyuserPay tbProxyuserPay, @LoginUserApi TbUser tbUser){
        tbProxyuserPay.setStatus(0);
        tbProxyuserPay.setUserid(tbUser.getUserId());
        tbProxyuserPay.setUsername(tbUser.getUsername());
        tbProxyuserPayService.save(tbProxyuserPay);
        return R.ok();
    }
}
